In a large scale computer system, such as a database management system (DBMS), it is important to be able to service a number of different users concurrently. Without such a capability, the system would be little more than a standalone computer. To implement multi-user support, several different processing models have been utilized. One model that has been used is the multi-processing model. In multi-processing, each time a new user requests access to the system, a separate process is started. This process is in essence a separate execution of the software. Once started, the process services all of the requests from the user that spawned it. Under the multi-processing model, each process has its own separate memory space for use in storing and processing data.
Multi-processing is effective for supporting multiple users concurrently; however, it has severe scalability limitations. This is due mainly to two factors. First, spawning and maintaining a process involves a significant amount of overhead. Because of the high cost, only a small number of processes can be maintained at any one time. Second, the same set of data, used by multiple processes, may be stored redundantly; once in each process"" memory space. This redundancy can waste a significant amount of system resources.
To overcome some of the limitations of multi-processing, the multi-thread model was developed. According to the multi-thread model, there is only one execution of the software. That is, only one process is spawned. From this one process, multiple threads can be spawned to perform the work necessary to service user requests.
Multi-threading has several advantages over multi-processing. First, because only one process is spawned, overhead is kept to a minimum. It is true that each thread carries with it some overhead cost, but this cost is negligible when compared with the cost of maintaining an entire process. Because multi-threading significantly reduces system overhead, many more users can be supported. Another advantage of multi-threading is that it minimizes the redundant storage of data. Because all of the threads are part of the same process, all of the threads can share the same memory space, and other system resources associated with that process.
A typical method of constructing an executable computer program to support concurrent users includes compiling a plurality of source code files into machine-code object files. These object files are then linked together at build time to yield a tightly-coupled monolithic executable image. For complex applications, the executable can be quite large. Although monolithic executables operate efficiently, they have a number of drawbacks, including difficulty in programming, constructing, testing, and modifying the software.
In accordance with preferred embodiments of the invention, a context management system manages both thread-local data and free-thread data in a flexible modular architecture. Preferably, thread data is segmented into an ordinal workspace structure. In a free thread architecture, each module can have its own private and public segments. The context management system allows many threadable, session contexts to share a lesser number of real operating system threads, maintained as a thread pool within the server process.
In accordance with a preferred embodiment of the invention, a multi-session computing system is programmed with a system for managing session context. First, a computer program is concurrently executable by a plurality of sessions. In particular, the computer program comprises a plurality of linked modules, each module programmed with a subset of the computer program. The modules are linked in a preassigned order to yield the computer program. The sessions are initiated by a plurality of clients, a module provides the interface between the computer program and a client.
Each session can include a plurality of transactions. A thread manager is included to assign computing threads to sessions. In a particular embodiment, a free-thread pool is managed by the thread manager.
A plurality of data segments are generated and accessible to the computer program for storing session data. A data segment can include a private subset of data and a public subset of data.
A database structure relates each session with at least one data segment to provide each session access to the stored session data. The database structure preferably includes an array of pointers to the data segments to bind a module with a data segment. A database manager module associates the database structure with the session data, the modules and the data segments. That association is provided by a computed index into the database structure.
The above and other features of the invention, including various novel details of construction and combination of parts, will now be more particularly described with reference to the accompanying drawings and pointed out in the claims. It will be understood that the particular system for dynamically constructing an executable computer program embodying the invention is shown by way of illustration only and not as a limitation of the invention. The principles and features of this invention may be embodied in varied and numerous embodiments without departing from the scope of the invention.